<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="shortcut icon" href="{{ asset('assets/favicon.ico') }}" >
    <title>{% block title %} {% endblock %}</title>
    <link href="{{ asset('assets/css/bootstrap.min.css') }}" rel="stylesheet">
    <link href="{{ asset('assets/css/l-style.css') }}" rel="stylesheet">
    <style type="text/css">
        .layout-href{
            position: absolute;
            bottom: 8px;
            font-size: 14px;
            text-align: center;
            color: #95a0aa;
            display: block;
            width: 100%;
        }
        .layout-href:hover{
            color: #fff;
        }
    </style>
    <script src="{{ asset('assets/js/jquery-1.9.1.min.js') }}"></script>
    <script src="{{ asset('assets/js/bootstrap.min.js') }}"></script>
    <script type="text/javascript" src="{{ asset('assets/js/pop_status.js') }}"></script>
    <script src="{{ asset('assets/js/common.js') }}"></script>

    <script>
        function logout(){
            $.post("{{ path('api_admin_auth_logout') }}",{},function(data){
                if(data.errorCode == 0){
                    popStatus(1,data.message,1,"{{ path('auth_login') }}",true);
                } else {
                    popStatus(2,data.message,1,"",true);
                }
            })
        }

        //获取侧边栏高度
        setTimeout(function() {
            $('.panel-group').height($('.main-content').height());

            $('.layout-href').show();
        }, 1000);

    </script>

    {% block css %}{% endblock %}
</head>
<body>
<div class="container">
    {% block top %}
        <div class="header">
            <div class="header-fl fl">科技小桌板</div>
            <div class="header-fr fr">
                <img src="{{ asset('assets/img/icon/default-avatar.png') }}" width="28" height="28" class="default-avatar fl">
                <span class="admin-name fl">{{ app.session.get("admin_name") }}</span>
                <img src="{{ asset('assets/img/icon/exit-icon.png') }}" onclick="logout()" width="16" height="16" class="login-exit fr">
            </div>
        </div>
    {% endblock %}

    {% block left_body_top %}
        <div class="super-admin">
            <img src="{{ asset('assets/img/icon/s-admin.png') }}" width="70" height="71">
            <span class="super-text">{% if app.session.get("admin_role_id") == 2 %}超级管理员 {% elseif app.session.get("admin_role_id") == 3 %}管理员{% elseif app.session.get("admin_role_id") == 4 %}科技载体{% endif %}</span>
        </div>

    {% endblock %}

     {% block left_body %}
    <div class="sidebar">
        <div class="panel-group" id="accordion"  style="position: relative;">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <div class="panel-title">
                        <div>
                            <a class="sidebar-list" href="{{ path('admin_index') }}" data-id="1">
                                <span class="sidebar-icon">
                                    <span class="side1"></span>
                                </span>
                                <span class="">首页</span>
                                <span class="r-arrow"></span>
                            </a>
                        </div>
                    </div>
                </div>
            </div>
            <div class="panel panel-default">
                <div class="panel-heading">
                    <div class="panel-title">
                        <div data-toggle="collapse" data-parent="#accordion" href="#collapseTwo">
                            <a class="sidebar-list" data-id="2" >
                                <span class="sidebar-icon">
                                    <span class="side2"></span>
                                </span>
                                <span class="">消息通知</span>
                                <span class="r-arrow"></span>
                            </a>
                        </div>
                    </div>
                </div>
                <div id="collapseTwo" class="panel-collapse collapse">
                    <div class="panel-body">
                        <ul class="son-sidebar">
                            <li>
                                <a class="sidebar-son-list" data-id="1" href="{{ path('article_notice_list') }}">公告列表</a>
                            </li>
                            <li>
                                <a class="sidebar-son-list" data-id="2" href="{{ path('article_training_list') }}">培训通知</a>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>
            <div class="panel panel-default">
                <div class="panel-heading">
                    <div class="panel-title">
                        <div>
                            <a class="sidebar-list" data-id="3"  href="{{ path('personal_list_index') }}">
                                <span class="sidebar-icon">
                                    <span class="side3"></span>
                                </span>
                                <span class="">人员管理</span>
                                <span class="r-arrow"></span>
                            </a>
                        </div>
                    </div>
                </div>
            </div>
            <div class="panel panel-default">
                <div class="panel-heading">
                    <div class="panel-title">
                        <div>
                            <a class="sidebar-list" data-id="4" href="{{ path('company_message_list') }}">
                                <span class="sidebar-icon">
                                    <span class="side4"></span>
                                </span>
                                <span class="">企业信息管理</span>
                                <span class="r-arrow"></span>
                            </a>
                        </div>
                    </div>
                </div>
            </div>
            <div class="panel panel-default">
                <div class="panel-heading">
                    <div class="panel-title">
                        <div>
                            <a class="sidebar-list" data-id="5" href="{{ path('project_list') }}">
                                <span class="sidebar-icon">
                                    <span class="side5"></span>
                                </span>
                                <span class="">申报看板</span>
                                <span class="r-arrow"></span>
                            </a>
                        </div>
                    </div>
                </div>
            </div>
            <div class="panel panel-default">
                <div class="panel-heading">
                    <div class="panel-title">
                        <div>
                            <a class="sidebar-list" data-id="6" href="{{ path('file_category') }}">
                                <span class="sidebar-icon">
                                    <span class="side6"></span>
                                </span>
                                <span class="">文件管理</span>
                                <span class="r-arrow"></span>
                            </a>
                        </div>
                    </div>
                </div>
            </div>
            <div class="panel panel-default">
                <div class="panel-heading">
                    <div class="panel-title">
                        <div data-toggle="collapse" data-parent="#accordion" href="#collapseSeven">
                            <a class="sidebar-list" data-id="7">
                                <span class="sidebar-icon">
                                    <span class="side7"></span>
                                </span>
                                <span class="">账号管理</span>
                                <span class="r-arrow"></span>
                            </a>
                        </div>
                    </div>
                </div>
                <div id="collapseSeven" class="panel-collapse collapse">
                    <div class="panel-body">
                        <ul class="son-sidebar">

                            {% if app.session.get("admin_role_id") == 2 %}
                            <li>
                                <a class="sidebar-son-list" href="{{ path('account_list_index') }}" data-id="1">普通管理员账号管理</a>
                            </li>
                            {% endif %}

                            <li>
                                <a class="sidebar-son-list" href="{{ path('account_examine_account') }}" data-id="2">科技联络人审核</a>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>
            <div class="panel panel-default">
                <div class="panel-heading">
                    <div class="panel-title">
                        <div data-toggle="collapse" data-parent="#accordion" href="#collapseEight">
                            <a class="sidebar-list" data-id="8">
                                <span class="sidebar-icon">
                                    <span class="side8"></span>
                                </span>
                                <span class="">系统设置</span>
                                <span class="r-arrow"></span>
                            </a>
                        </div>
                    </div>
                </div>
                <div id="collapseEight" class="panel-collapse collapse">
                    <div class="panel-body">
                        <ul class="son-sidebar">
                            <li>
                                <a class="sidebar-son-list" href="{{ path('setting_index') }}" data-id="1">个人信息</a>
                            </li>
                            <li>
                                <a class="sidebar-son-list" href="{{ path('setting_edit_password') }}" data-id="2">修改密码</a>
                            </li>
                            <li>
                                <a class="sidebar-son-list" href="{{ path('setting_company_category') }}" data-id="3">企业类别管理</a>
                            </li>
                            <li>
                                <a class="sidebar-son-list" href="{{ path('setting_company_attribute') }}" data-id="4">企业属性管理</a>
                            </li>
                            {% if app.session.get("admin_role_id") == 2 %}
                            <li>
                                <a class="sidebar-son-list" href="{{ path('setting_banner_list') }}" data-id="5">Banner图管理</a>
                            </li>
                            {% endif %}
                            <li>
                                <a class="sidebar-son-list" href="{{ path('setting_agreement') }}" data-id="6">注册协议管理</a>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>

            <a href="" class="layout-href" style="display: none;">π+派伽提供技术支持</a>
        </div>
    </div>


    {% endblock %}

    {% block right_body %}{% endblock %}

    {% block body %}{% endblock %}

</div>


{% block box %}
{% endblock %}


{% block javascript %}
<script type="text/javascript">

    // 分页
    function pageAction(count,allpage){

        console.log(count);
        $(".pagination").empty();

        var html = '';
        html += '<li><a href="javascript:;" class="last-page" data-allcount="'+ allpage +'">&laquo;</a></li>';

        for(var i=0;i<allpage;i++){

            var key = parseInt(i)+1;

            if(i== 0){
                html += '<li><a href="javascript:;" class="mes-page-check" data-allcount="'+ allpage +'">'+ key +'</a></li>';
            } else {
                html += '<li><a href="javascript:;" data-allcount="'+ allpage +'">'+ key +'</a></li>';
            }

        }

        html += '<li><a href="javascript:;" class="next-page" data-allcount="'+ allpage +'">&raquo;</a></li>';

        $(".pagination").append(html);
    }

    // 分页点击事件
    $("body").on("click",".pagination li a",function(){
        var $this = $(this);
        var curr_page =  parseInt($(".mes-page-check").text());

        var all_count = parseInt($(this).data("allcount"));


        // 判断点击按钮
        var is_next = $(this).hasClass("next-page");
        var is_last = $(this).hasClass("last-page");


        // 点击下一页
        if(is_next && curr_page < all_count){

            $(".pagination li a").removeClass("mes-page-check");
            var now_page = parseInt(curr_page + 1);
            $(".pagination li a").each(function(){
                var _this = $(this);
                if(parseInt( _this.text()) == now_page){
                    _this.addClass("mes-page-check");
                    $("table tbody").empty();
                    addSearchAction(now_page);

                }

            })

        }

        // 点击上一页
        if(is_last && curr_page > 1){

            $(".pagination li a").removeClass("mes-page-check");
            var now_page = parseInt(curr_page - 1);
            $(".pagination li a").each(function(){
                var _this = $(this);
                if(parseInt( _this.text()) == now_page){
                    _this.addClass("mes-page-check");
                    $("table tbody").empty();
                    addSearchAction(now_page);

                }

            })
        }

        // 点击页码
        if(!is_next && !is_last){
            $(".pagination li a").removeClass("mes-page-check");
            $this.addClass("mes-page-check");
            $("table tbody").empty();
            var this_page = $this.text();
            addSearchAction(this_page);
        }
    })

</script>
{% endblock %}

</body>
</html>